
<template>
  <div>
    <p class="title">热销推荐</p>
    <ul>
      <router-link class="iteam border-bottom" 
          v-for="vaul of recommendLsit" :key="vaul.id" 
          v-if="recommendLsit.length"
          tag="li"
          :to="'/detail/' +  vaul.id"
      >
        <img class="iteam-img" :src="vaul.imgUrl">
        <div class="iteam-info">
          <p class="iteam-title">{{ vaul.title }}</p>
          <p class="iteam-desc">{{ vaul.desc}}</p>
          <button class="iteam-button">查看详情</button>
        </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  name: "Recommend",
  props: {
    list: Array
  },
  data() {
    return {
      recommendLsit: this.list
    }
  },
  watch: {
    list(n) {
      this.recommendLsit = n
    }
  }
}
</script>

<style lang="stylus" scoped>
@import "~styles/minxins.styl"
  .title
    text-indent: .2rem
    line-height: .7rem
    background: #eee
    margin-top: .2rem
    font-weight: 900
  .iteam
    overflow: hidden
    display: flex
    height: 1.9rem
    padding-left: .1rem 
  .iteam  .iteam-img
    margin-top: .1rem
    width: 1.7rem
    height: 1.7rem
  
  .iteam-info
    padding: .1rem
    padding-left: .15rem
    min-width: 0 
    .iteam-title
      line-height: .54rem
      font-size: .32rem
      ellipsis()
    .iteam-desc
      line-height: .4rem
      color: #ccc
      ellipsis()
    .iteam-button
      background: #ff9300
      padding: 0 .1rem
      border-radius: 0.02rem
      margin-top: .2rem
      color: #fff
</style>

